﻿@using Webdiyer.WebControls.Mvc;
@model PagedList<Inspinia_MVC5.Models.Book>

    <table class="table table-striped">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.BookType.TypeName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.BookName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.BokISBN)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.BookAuthor)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.BookPress)
            </th>
            
            <th>
                @Html.DisplayNameFor(model => model.BookMoney)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.BookOverdue)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Status)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.BookNum)
            </th>
            
            <th>
                @Html.DisplayNameFor(model => model.BookJieYueLiang)
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.BookType.TypeName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.BookName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.BokISBN)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.BookAuthor)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.BookPress)
                </td>
                
                <td>
                    @Html.DisplayFor(modelItem => item.BookMoney)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.BookOverdue)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Status)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.BookNum)
                </td>
                
                <td>
                    @Html.DisplayFor(modelItem => item.BookJieYueLiang)
                </td>
                <td>
                    @{
                        if (item.BookNum > 0)
                        {
                            @Html.ActionLink("借阅", "Create", "Borrows", new { id = item.ID }, new { @class = "btn btn-primary btn-sm" })

                        }
                        else
                        {
                            <span>库存不足</span>
                            @*@Html.ActionLink("库存不足", "Create", "Borrows", new { id = item.ID }, new { @class = "btn btn-primary btn-sm" })*@

                        }

                    }
                    @*@Html.ActionLink("Edit", "Edit", new { id = item.ID }, new { @class = "btn btn-white btn-sm" })
        @Html.ActionLink("Delete", "Delete", new { id = item.ID }, new { @class = "btn btn-white btn-sm" })*@
                </td>
            </tr>
        }
</table>